<?php
    ob_start();
    session_start();
    
    require_once 'inc/database/DataBase.php';
    $db = new DataBase();
    
    $db->connect('localhost', '', 'io', 'root', '');
    
    include ('inc/step.php');
    
?>

<!DOCTYPE html>
<html lang="pl">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Restauracje ONLine</title>
    <link href="css/bs/bootstrap.css" rel="stylesheet">
    <link href="css/main/style.css" rel="stylesheet">
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
    <![endif]-->
</head>

<body>
    <div id="wrap">
        <div class="navbar navbar-default navbar-fixed-top" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <a class="navbar-brand" href=".">Restauracje Online</a>
                </div>
                <div class="collapse navbar-collapse">
                    <ul class="nav navbar-nav">
                        <li class="active"><a href="#">Start</a></li>
                        <li><a href="#">Lista restauracji</a></li>
                        <li><a href="#" class="featured">Złóż zamówienie!</a></li>
                    </ul>

                    <form class="navbar-form navbar-right" role="search">
                        <div class="form-group">
                            <input type="text" class="form-control" placeholder="Szukaj...">
                        </div>
                        <button type="submit" class="btn btn-default">Szukaj</button>
                    </form>
                    <ul class="nav navbar-nav navbar-right">
                        <li class="dropdown">
                            <div class="welcomeTxt">
                            <?php
                                $user = isset($_SESSION['user']) ? $_SESSION['user'] : '';
                            
                                if( !empty($user) )
                                    echo 'Witaj, <b>'.$user.'</b> <a href="?page=login&logout" class="logout"></a>!';
                                else
                                    echo '<a href="?page=login">Zaloguj się!</a>'
                            ?>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
        </div>

        <!-- Begin page content -->
        <div class="container">
            <div class="row">
                <div class="col-sm-2">
                    <ul id="sidebar" class="nav nav-pills nav-stacked">
                        <?php
                            $activeStart = ( $step == "" ) ? 'class="active"' : "";
                            $activeLista = ( $step == "listarestauracji" ) ? 'class="active"' : "";
                            $activeZamowienie = ( $step == "restauracja" ) ? 'class="active"' : "";
                        ?>
                        <li <?php echo $activeStart; ?>><a href="#">Start</a></li>
                        <li <?php echo $activeLista; ?>><a href="#">Lista restauracji</a></li>
                        <li <?php echo $activeZamowienie; ?>><a href="#">Złóż zamówienie!</a></li>
                        <?php
                            if( $step == "podsumowanie" )
                            {
                                echo '<li class="active"><a href="#">Podsumowanie</a></li>';
                            }
                        ?>
                    </ul>
                </div>
                <div class="col-sm-10">
                    <?php
                        $page = isset( $_GET['page'] ) ? $_GET['page'] : "";
                        
                        
                        switch($page)
                        {
                            case 'login':
                            {
                                include( 'inc\login.php' );
                                break;
                            }
                            default :
                            {
                                include ( 'inc\main.php' );
                            }
                        }
                    ?>
                </div>
            </div>

            <div id="footer">
                <div class="container">

                    <p class="text-muted">Restauracje online &copy; 2013 | <a href="adminPanel/">Panel Administratora</a> | <a href="kucharz/">Panel Kucharza | <a href="kelner/">Panel Kelnera</a> | <a href="owner/">Panel Właściciela</a> |</p>
                </div>
            </div>
</body>
</html>

<?php

ob_end_flush();

?>